#pragma once

#include <qobject.h>
#include <qdatetime.h>

class FileWriter;

class LogSaver : public QObject
{
	Q_OBJECT
public:
	enum LogFlag
	{
		Debug = 0x01,
		Information = 0x02,
		Warning = 0x04,
		Critical = 0x08
	};
private:
	int logLevel = Critical | Warning | Information;
	QString logFilePath = "MemsAutoTestSoftware_Log.log";
	QString newLine = "\r\n";
	QString QString_debug = "(Debug)";
	QString QString_information = "(Information)";
	QString QString_warning = "(Warning)";
	QString QString_critical = "(Critical)";

	FileWriter* fileWriter = Q_NULLPTR;
public:
	LogSaver(QObject* parent = Q_NULLPTR);
	~LogSaver();
public slots:
	void slot_log(QString msg, LogFlag logFlag);
public:
	void enableLogLevel(LogFlag logFlag);
	void disableLogLevel(LogFlag logFlag);
	QString getQStringOfLogFlag(LogFlag logFlag);
public:
	int getLogLevel();
	QString getLogFilePath();
	void setLogFilePath(QString filePath);
	FileWriter* getFileWriter();
	void setFileWriter(FileWriter* fileWriter);
};